import parentModel from "../parentModel";
export default class biModel extends parentModel  {
    constructor() {
        super(biModel,util.api.BiModel);
        this.table='biModels';
        this.typeList=['bi'];
        /** modelMap格式
         * {
            table: tableName,
            featureList: new Set(),
            valueList: new Set(),
            fieldList: new Set(),
            groupList: new Set(),
            fieldMap: {
            fieldname；fieldtype
            },
          }
         */
    }
    static create(record){
        let object=new biModel();
        if(!!record){
            object.setRecord(record);
        };
        return object;
    }
    setRecord(record){
        if(!!record.type&&!!record.className){
            this.record=record;
            this._setPointer();
            if(Object.keys(this.record.web).length===0){
                this.record.web=biModel.webTpl();
                this.record.hier=biModel.hierTpl();
            }
        }else{
            this.record={};
            this._setPointer(false);
        }

    }
    static tpl(){
        return {
            // id: "",
            type:"",
            className:"",
            version: 1,
            published: true,
            features:[],
            values:{},
            hier:[],
            web:{},
            others:{},
            // createTime: dayjs.localeData(),
            // updateTime: (new Date()).toLocaleDateString(),
            comments: ""
        }
    }
    /**
     * 流程配置模板
     */
}
